package com.iflytek.uoamp.agent.monitor.mcagent;

import com.iflytek.uoamp.agent.common.constants.CommonConstants;
import org.apache.log4j.Logger;

import com.iflytek.uoamp.agent.core.conf.AgentCoreConfig;
import com.iflytek.uoamp.agent.monitor.find.FinderThread;



/**
 * 
 * @ClassName: MCinitializer
 * @Description: 初始化配置文件
 * @author qinanyuan
 * @date 2017年3月23日 下午3:21:45
 */
public class MCinitializer {

	public void initial() throws Exception {
		/**
		 * 初始化配置文件
		 * 1.quartz.properties
		 * 2.monitor.properties
		 * 3.find.properties
		 */
		boolean isLinux = AgentCoreConfig.getInstance().isLinux();
    	if(isLinux){
    		System.setProperty(CommonConstants.QUARTZ_FILE, CommonConstants.LINUX_QUARTZ_PATH);
    		MCAgentConfig.getInstance().init( CommonConstants.LINUX_MONITOR_PATH);
    		Logger.getRootLogger().info("use linux conf monitor.properties!");
    	}else{
    		System.setProperty(CommonConstants.QUARTZ_FILE, CommonConstants.WIN_QUARTZ_PATH);
    		MCAgentConfig.getInstance().init(CommonConstants.WIN_MONITOR_PATH);
    		Logger.getRootLogger().info("use windows conf monitor.properties!");
    	}
		
		FinderThread.getFindMonitor().init();
		
	}		
}
